<!--
https://apifox.com/apidoc/shared-9e650053-2f82-44db-9361-67df9f4ed420/api-94669030
-->
<template>

</template>



<style scoped>

</style>
<script setup>

import {ref, onMounted, onBeforeUnmount, onUnmounted,watch,computed} from "vue";
import { useStore} from 'vuex';
import Enum from "@/js/Enum";


let store = useStore();
let clsid=winApp.getClsId();

/*组件挂载完成后执行的函数；*/
onMounted(() => {
  console.log("GameData onMounted  ");
  if(window.location.href.indexOf('https:')>=0){
    store.state.data_url='https://api-web.shankuishuo.com/';
  }

  //获取真实数据 打开
 // setInitConfig();
  initData();



});



onBeforeUnmount(() => {
  console.log('GameData onBeforeUnmount 销毁之前==');
})
onUnmounted(() => {
  //卸载组件实例后调用,调用此钩子时,组件实例的所有指令都被解除绑定,所有事件侦听器都被移除,所有子组件实例被卸载。
  winApp.deleteNotification(clsid);
  console.log("GameData onUnmounted 卸载组件实例后  ",clsid);
});

function initData(){
  document.addEventListener('DOMContentLoaded', function() {
    let bodyHeight = document.body.clientHeight;
    // 或者使用
    let viewportHeight = window.innerHeight || document.documentElement.clientHeight;

    store.state.bodyHeight=(bodyHeight===0?viewportHeight:bodyHeight);

    let bodyWidth = document.body.clientWidth;
    // 或者使用
    let viewportWidth = window.innerWidth || document.documentElement.clientWidth;

    store.state.bodyWidth=(bodyWidth===0?viewportWidth:bodyWidth)
    console.log('Body clientHeight:', store.state.bodyHeight,store.state.bodyWidth);



  });
}




function setInitConfig(){
  let https = window.location.href.substr(0, 5);
  // store.state.appType=Enum.appType_0;
  let appTy=Util.getAppType();
  if(appTy===Enum.appType_0){
    store.state.animation_type=0;
  }else{
    store.state.animation_type=1;
  }
  let meck=Util.GetUrlParam('mcheck');
  if(meck=='')meck=Util.getCookie('mcheck');
  if(meck=='')meck=Util.GetUrlParam('meck');
  console.log('GameData setInitConfig 1 ',meck=='');
  if(meck=='')return;
  store.state.mcheck=meck;

  let uid = Util.getCookie("comm_uid");
  if(uid=="")uid=Util.GetUrlParam("uid");
  if(uid=="")uid=Util.GetUrlParam("userId");
  if(uid=="")uid=Util.GetUrlParam("userid");
  store.state.userId=uid;


  store.state.roomId=Util.GetUrlParam("roomId");
  if(store.state.roomId=="")store.state.roomId=Util.GetUrlParam("roomid");
  if(store.state.roomId=='')store.state.roomId=Util.getCookie("roomId");



  let webToken=Util.GetUrlParam('webToken');
  if(webToken=='')webToken=Util.getCookie('webToken');
  store.state.webToken=webToken;

  let activity=Util.GetUrlParam('activity');

  if(activity!='')store.state.activity=activity;
  if(store.state.activity==1){
    store.state.appType=appTy;
    store.state.data_url='https://act-vas.qxiu.com';
  }else{
    store.state.appType=Enum.appType_1;
    store.state.data_url='http://act.vas.qxiu.com';
    if(https=='https') store.state.data_url='https://act-vas.qxiu.com';
  }


}





</script>
